#ifndef MODEL_H
#define MODEL_H

#include <QDir>
#include <QFileInfo>
#include "Shader.h"
#include "mesh.h"
#include "tiny_gltf.h"
#include "Material.h"

using namespace std;

#define SUPPORT_VEC 0

class Model
{
public:
    Model(QOpenGLFunctions_3_3_Core *glfuns,const char *path):m_glFuns(glfuns) {
        loadModel(path);
    }
    void Draw(Shader &shader);


    QMap<int, QString> s_meshNames;
#if SUPPORT_VEC
    //QMap<int, vector<Vertex>> s_vertices;
    QMap<int, QVector<QVector3D>> s_vertices;
    QMap<int, QVector<unsigned int>> s_indices;
#else
    QMap<int, QVector<QVector3D>> s_vertices;
    QMap<int, QVector<unsigned int>> s_indices;
#endif
    QMap<int, QVector<QVector2D>> s_texcoords;
    QMap<int, Material> s_materials;
    QMap<int, QVector<QVector3D>> s_normals;
    void loadModel(string path);
private:
    QOpenGLFunctions_3_3_Core *m_glFuns;
};

#endif // MODEL_H
